Tcl_Startup

Section: Misc. Reference Manual Pages (TCL)
Updated:
Index Return to Main Contents
 

NAME

Tcl_ShellEnvInit, Tcl_Startup, Tcl_CommandLoop, Tcl_ErrorAbort - Extended Tcl Shell startup facilities.  

SYNOPSIS

#include "tclExtend.h"

extern char *tclAppName;
extern char *tclAppLongname;
extern char *tclAppVersion;

int
Tcl_ShellEnvInit (Tcl_Interp  *interp,
                  unsigned     options,
                  const char  *programName,
                  int          argc,
                  const char **argv,
                  int          interactive,
                  const char  *defaultFile);

void
Tcl_Startup (Tcl_Interp  *interp,
             int          argc,
             const char **argv,
             const char  *defaultFile,
             unsigned     options);

void
Tcl_CommandLoop (Tcl_Interp *interp,
                 FILE       *inFile,
                 FILE       *outFile,
                 int         (*evalProc) (),
                 unsigned    options);

void
Tcl_ErrorAbort (Tcl_Interp  *interp,
                int          exitCode);

 

DESCRIPTION

These commands control the startup of a Tcl shell and related functions. They allow any program to use Tcl shell functionality such as default and initialization files and Tcl package libraries.  

tclAppName

The application name to be returned by the infox command. This should be a short mnemonic. If a special value is desired, it must be set before one of the startup procedures are called.  

tclAppLongname

The application long name to be returned by the infox command. This should be a natural language string. If a special value is desired, it must be set before one of the startup procedures are called.  

tclAppVersion

The application version string to be returned by the infox command. If a special value is desired, it must be set before one of the startup procedures are called.  

Tcl_ShellEnvInit

Setup the environment used by the Tcl shell. Global variables used by the shell are initialized and the TCLDEFAULT file is located and processed. This is normally done as part of Tcl_Startup, however this interface is provided for application that want to use the Tcl features, such as libraries, without using the standard command loop. Windowed applications require this, since input is done via an event loop.

Parameters:

o interp - A pointer to the interpreter.
o options - Flags to control the behavior of this routine, the following option is supported:

- TCLSH_QUICK_STARTUP - Don't source the default file or Tcl init file.
- TCLSH_ABORT_STARTUP_ERR - If set, abort the process if an error occurs.
- TCLSH_NO_INIT_FILE - If set, process the default file, but not the init file. This can be used to make the default file do all initialization.

o programName - The name of the program being executed, usually taken from the main argv [0]. Used to set the Tcl variable. If NULL then the variable will not be set.
o argc, argv - Arguments to pass to the program in a Tcl list variable `argv'. Argv [0] should contain the first argument, not the program name. If argv is NULL, then the variable will not be set.
o interactive - The value to assign to the `interactiveSession' Tcl variable. TRUE if an interactive Tcl command loop will be entered, FALSE if a script will be executed . The function does not enter the command loop, it just sets the variable.
o defaultFile - The file name of the default file to use. If NULL, then the standard Tcl default file is used, which is formed from a location specified at compile time and the Extended Tcl version number.

Notes:

The variables tclAppName, tclAppLongname, tclAppVersion must be set before calling thus routine if special values are desired.

Returns:

TCL_OK if all is ok, TCL_ERROR if an error occurred.
 

Tcl_Startup

Initializes the Tcl extended environment. This function processes the standard command line arguments and locates the Tcl default file. It then sources the default file and initialization file pointed to by the default file. Either an interactive command loop is created or a Tcl script file is executed depending on the command line. This functions calls Tcl_ShellEnvInit, so it should not be called separately.

Parameters

o interp - A pointer to the interpreter.
o argc, argv - Arguments passed to main for the command line.
o defaultFile (I) - The file name of the default file to use. If NULL, then the standard Tcl default file is used, which is formed from a location specified at compile time and the Extended Tcl version number.
o options - Options that control startup behavior. None are currently defined.

Notes:

The variables tclAppName, tclAppLongname, tclAppVersion must be set before calling thus routine if special values are desired.
 

Tcl_CommandLoop

Run a Tcl command loop. The command loop interactively prompts for, reads and executes commands. Two entries in the global array TCLENV contain prompt hooks. A prompt hook is Tcl code that is executed and its result is used as the prompt string. The element `topLevelPromptHook' is the hook that generates the main prompt. The element `downLevelPromptHook' is the hook to generate the prompt for reading continuation lines for incomplete commands. If a signal occurs while in the command loop, it is reset and ignored. EOF terminates the loop.

Parameters:

o interp - A pointer to the interpreter
o inFile - The file to read commands from.
o outFile - The file to write the prompts to.
o evalProc - The function to call to evaluate a command. Should be either Tcl_Eval or Tcl_RecordAndEval if history is desired.
o options - Currently unused.
 

Tcl_ErrorAbort

Display error information and abort when an error is returned in the interp->result.

Parameters:

o interp - A pointer to the interpreter, should contain the error message in `result'.
o exitCode - The code to pass to exit.


 

Index

NAME
SYNOPSIS
DESCRIPTION
tclAppName
tclAppLongname
tclAppVersion
Tcl_ShellEnvInit
Tcl_Startup
Tcl_CommandLoop
Tcl_ErrorAbort

This document was created by man2html, using the manual pages.
Time: 22:46:07 GMT, December 11, 2024